package cate.game.chat;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.*;

@Slf4j
public class ChatThread {

    private static int rejectCount = 0;

    public static ExecutorService es = new ThreadPoolExecutor(0, 3,
            60L, TimeUnit.SECONDS,
            new LinkedBlockingQueue<>(2));

    public static void exe(Runnable runnable) {
        try {
            es.submit(runnable);
        } catch (RejectedExecutionException e) {
            rejectCount++;
        } catch (Exception e) {
            log.error("", e);
        }
    }
}
